
package sg.edu.nus.iss.cats.dataaccess.mysql;

import sg.edu.nus.iss.cats.dataaccess.*;
import sg.edu.nus.iss.cats.model.*;


public class EmployeeDAOImpl implements EmployeeDAO {

    public Employee findEmployee (String employeeId) throws DAOException{

        SQLObjectManager mgr = new SQLObjectManager (
            new EmployeeObjectHandler ());
        String constraint = DBConstants.e_employeeId + "='" + employeeId + "'";
        mgr.setQueryConstraint (constraint);
        Employee result = (Employee) mgr.getObject ();
        return (result);
    }

    public Employee[] findEmployeesByManager (String managerId) throws DAOException{
        SQLObjectManager mgr = new SQLObjectManager (
            new EmployeeObjectHandler ());
        String constraint = DBConstants.e_managerId + "='" + managerId + "'";
        mgr.setQueryConstraint (constraint);
        Employee[] results = (Employee[]) mgr.getObjects ();
        return (results);
    }

    public void insertEmployee (Employee employee)
                        throws DAOException{
        throw new DAOException ("Not yet implemented!");
    }

    public void updateEmployee (Employee employee)
                        throws DAOUpdateException {
        throw new DAOUpdateException ("Not yet implemented!");
    }

    public void deleteEmployee (Employee employee)
                        throws DAOException{
        throw new DAOException ("Not yet implemented!");
    }

}